import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *


class MyWindow(QWidget):
    def __init__(self):
        super(MyWindow, self).__init__()
        self.setWindowTitle('labelBar')

        nameLb1=QLabel('&Name',self)
        nameEd1=QLineEdit(self)
        nameLb1.setBuddy(nameEd1)

        nameLb2=QLabel('&Password',self)
        nameEd2=QLineEdit(self)
        nameLb2.setBuddy(nameEd2)

        btnOK=QPushButton('&OK')
        btnCanel=QPushButton('&Cancel')
        mainLayout=QGridLayout(self)
        mainLayout.addWidget(nameLb1,0,0)
        mainLayout.addWidget(nameEd1,0,1,1,2)

        mainLayout.addWidget(nameLb2,1,0)
        mainLayout.addWidget(nameEd2,1,1,2,2)

        mainLayout.addWidget(btnOK,2,1)
        mainLayout.addWidget(btnCanel,2,2)


    def link_hovered(self):
        print(1)

    def link_clicked(self):
        print(2)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    myshow = MyWindow()
    myshow.show()
    sys.exit(app.exec_())
